package task04;

import java.io.Serializable;
import java.util.Objects;

public class UserMessage implements Serializable {
    private static final long serialVersionUID = -8738471796819401843L;
    private User user;
    private String type;

    public UserMessage() {
    }

    public UserMessage(User user) {
        this.user = user;
        this.type = "pending";
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserMessage that = (UserMessage) o;
        return Objects.equals(user, that.user) &&
                Objects.equals(type, that.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(user, type);
    }

    @Override
    public String toString() {
        return "UserMessage{" +
                "user=" + user +
                ", type='" + type + '\'' +
                '}';
    }
}
